<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <base href="<%=request.getContextPath()%>/">
    <meta http-equiv="Content-Type" content="text/html"; charset="utf-8" />
    <title>客房情况</title>
    <link href="css/main.css" rel="stylesheet" type="text/css">
    <link href="bstable/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="bstable/css/bootstrap-table.css" rel="stylesheet" type="text/css">

</head>
<body>
<div class="tabe_div">
    <form action="hotel/rooms" method="post">
    <p class="p_line text_ient"><a class="find_a">名称：</a><input type="text" value="${roomname}" name="roomname" class="form_input text_ient" placeholder="输入名称"/>
        <a  class="find_a">酒店星级：</a>
        <select class="form_select" style="padding-left: 1%;" name="roomstar">
            <option value="0" <c:if test="${roomstar == 0}">selected="selected"</c:if>>全部</option>
            <option value="1" <c:if test="${roomstar == 1}">selected="selected"</c:if>>1星</option>
            <option value="2" <c:if test="${roomstar == 2}">selected="selected"</c:if>>2星</option>
            <option value="3" <c:if test="${roomstar == 3}">selected="selected"</c:if>>3星</option>
            <option value="4" <c:if test="${roomstar == 4}">selected="selected"</c:if>>4星</option>
            <option value="5" <c:if test="${roomstar == 5}">selected="selected"</c:if>>5星</option>
        </select>
        <a  class="find_a">状态：</a>
        <select class="form_select" style="padding-left: 1%;" name="kong">
            <option value="0" <c:if test="${kong == 0}">selected="selected"</c:if>>全部</option>
            <option value="1" <c:if test="${kong == 1}">selected="selected"</c:if>>有剩余房间</option>
            <option value="2" <c:if test="${kong == 2}">selected="selected"</c:if>>无空余房间</option>
        </select>
        <input type="submit" value="查询" class="but_find"/><p>
    <p class="p_table">
    </form>
        <a href="#" class="a_add">全部导出</a>
    </p>


    <table id="table" class="table_style" style="margin: 0 auto" >
        <c:forEach var="rooms" items="${roomsList}">
            <tr>
                <td>${rooms.ho_room_id}</td>
                <td>${rooms.ho_room_name}</td>
                <td>${rooms.ho_room_star}</td>
                <td>${rooms.ho_room_surplus}</td>
                <td>${rooms.ho_room_number}</td>
                <td><fmt:formatDate value="${rooms.ho_room_buildTime}" pattern="yyyy-MM-dd"/></td>
                <td>${rooms.ho_room_phone}</td>
                <td>${rooms.ho_room_adress}</td>
            </tr>
        </c:forEach>
    </table>





</div>
<div></div>
<script src="js/jquery.js"></script>
<script src="js/date/js/laydate.js"></script>
<script src="bstable/js/bootstrap.min.js"></script>
<script src="bstable/js/bootstrap-table.js"></script>
<script src="bstable/js/bootstrap-table-zh-CN.min.js"></script>
<script>
    !function () {
        laydate.skin('danlan'); //切换皮肤，请查看skins下面皮肤库
        laydate({ elem: '#demo' });
        laydate({ elem: '#demo1' }); //绑定元素
    } ();
</script>

<script type="text/javascript">
    $(function() {
        $('#table')
            .bootstrapTable({
                method: "get",
                striped: true,
                singleSelect: false,
                url: "/xiaozu/json/hotelBasic.json",
                dataType: "json",
                pagination: true, //分页
                pageSize: 10,
                pageNumber: 1,
                search: false, //显示搜索框
                contentType: "application/x-www-form-urlencoded",
                queryParams: null,
                columns: [
                    {
                        title: "编号",
                        field: 'id',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '酒店名称',
                        field: 'name',
                        align: 'center',
                        valign: 'middle'
                    },
                    {
                        title: '星级',
                        field: 'star',
                        align: 'center'
                    },
                    {
                        title: '剩余房间数（间）',
                        field: 'remaining',
                        align: 'center',
                        formatter: function(value, row) {
                            var c = "<a onclick='showRoomsRem(" + row.id + ")'>" + value + "</a>";
                            return c;
                        }
                    },
                    {
                        title: '总房间数（间）',
                        field: 'all',
                        align: 'center',
                        formatter: function(value, row) {
                            var c = "<a onclick='showRoomsAll(" + row.id + ")'>" + value + "</a>";
                            return c;
                        }
                    },
                    {
                        title: '建立时间',
                        field: 'buildTime',
                        align: 'center'
                    },
                    {
                        title: '联系电话',
                        field: 'phone',
                        align: 'center'
                    },
                    {
                        title: '详细地址',
                        field: 'address',
                        align: 'center'
                    },
                    {
                        title: '操作',
                        field: 'oper',
                        align: 'center',
                        formatter: function(value, row) {
                            var c = '<button button="#" mce_href="#" onclick="viewHotel(\'' +row.id +'\')">酒店详情</button> ';
                            return c;
                        }
                    }
                ]
            });
    });

    function handleEvent(id) {
        this.location.href = "alam_handle.jsp";

    }


</script>
<script src="layer_v2.1/layer/layer.js"></script>
<script type="text/javascript">
    function viewHotel(id){
        layer.open({
            type: 2,
            title: '酒店信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: 'hotel/viewHotel?roomid='+id,
            end:function () {
                location.reload();
            }
            //iframe的url
        });
    }
    function openlayer(id) {
        layer.open({
            type: 2,
            title: '添加信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: 'layer_box.jsp'
            //iframe的url
        });
    }

    function showHotelInfo(id) {
        layer.open({
            type: 2,
            title: '酒店信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: 'hotelInfo.jsp'
            //iframe的url
        });
    }

    function showRoomsRem(id) {
        layer.open({
            type: 2,
            title: '酒店信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: 'remainingRooms.jsp'
            //iframe的url
        });
    }

    function showRoomsAll(id) {
        layer.open({
            type: 2,
            title: '酒店信息',
            shadeClose: true,
            shade: 0.5,
            skin: 'layui-layer-rim',
            //            maxmin: true,
            closeBtn: 1,
            area: ['80%', '75%'],
            shadeClose: true,
            closeBtn: 1,
            content: 'remainingRooms.jsp'
            //iframe的url
        });
    }
</script>
</body>
</html>
